home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / CURSOR.SWG / 0003_Cursor Handling #2.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  2KB  |  47 lines

  1. MN> Anyone have any code on hiding the cursor and then bringing it back.
  2.  
  3. MN>                               -+- Mike Normand -+-
  4.  
  5.  
  6. I've seen many replies to this but all suffer the same disadvantage: they all
  7. assume you know the size of the cursor. A little bit debugging BASIC reveals
  8. what's up (by the way, you'll find it described in some good books): you have
  9. to set bit 5 For the start line and the cursor will disappear since this value
  10. is not allowed. To get the cursor back again, clear bit 5 again. Use this
  11. solution, if you Really just want to turn on/off the cursor. CursorOn/CursorOff
  12. do *not* change the cursor shape!!! and do *not* need an external Variable to
  13. manage this.
  14.  
  15. The  PUSH BP / POP BP  is needed For some *very* old BIOS versions using CGA/
  16. monochrome :-( display, that trash BP during an INT 10h. If you just want do
  17. support EGA/VGA :-) and better, just push 'em out.
  18.  
  19. -----------------------------------------------------
  20. Procedure CursorOff; Assembler;
  21. Asm
  22.     push bp            { For old BIOSs }
  23.     xor  ax, ax
  24.     mov  es, ax
  25.     mov  bh, Byte ptr es:[462h]  { get active page }
  26.     mov  ah, 3
  27.     int  10h           { get cursor Characteristics }
  28.     or   ch, 00100000b
  29.     mov  ah, 1
  30.     int  10h           { set cursor Characteristics }
  31.     pop  bp            { restore bp For old BIOSs }
  32. end;
  33.  
  34. Procedure CursorOn; Assembler;
  35. Asm
  36.     push bp            { old BIOSs like this... }
  37.     xor  ax, ax
  38.     mov  es, ax
  39.     mov  bh, Byte ptr es:[462h]  { get active page }
  40.     mov  ah, 3
  41.     int  10h           { get cursor Characteristics }
  42.     and  ch, 00011111b
  43.     mov  ah, 1
  44.     int  10h           { set cursor Characteristics }
  45.     pop  bp            { ...and this, too }
  46. end;
  47.